<template>
  <section>
    <el-form size="mini" label-width="100px">
      <el-form-item label="商品名称：">
        <el-input size="mini" v-model="goodsBase.title" style="width:50%"></el-input>
      </el-form-item>
      <el-form-item label="商品类型：">
        <el-select size="mini" v-model="goodsBase.goodsTypeId"  @change="selGoodsTypeEvent" v-if="typeList">
          <el-option v-for="type in typeList" :key="type.id" :value="type.id" :label="type.name"/>
        </el-select>
      </el-form-item>
      <el-form-item label="业务类型：">
        <business-type :code="goodsBase.data.businessTypeCode" v-on:selType="goodsBase.data.businessTypeCode = $event"></business-type>
      </el-form-item>
      <el-form-item label="基本属性：" v-if="goodsBase.goodsTypeId">
        <el-row v-for="(prop,index) in propList" :key="index">
          <el-col :span="2">{{prop.key}}</el-col>
          <el-col :span="4">
            <el-switch v-model="prop.val" active-text="是" inactive-text="否"></el-switch>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="" >
        <el-row style="float: right">
          <el-button size="mini" type="success" @click="confirmBtn(goodsBase)" :type="goodsBase.id?'primary':'success'">{{goodsBase.id?'保存':'新建'}}</el-button>
        </el-row>
      </el-form-item>
    </el-form>
  </section>
</template>

<script>
  export default {
    name: "newGoods",
    props:['goodsBase'],
    data(){
      return{

      }
    },
    created(){
      console.log('为毛！！！！！！')
    },
    computed: {
      ...mapGetters(['department']),
    },
    methods: {
      ...mapActions({
        fetch: 'fetch'
      }),
    }
  }
</script>

<style scoped>

</style>
